@ibiz-template-plugin/ai-chat 0.0.98 → 0.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -3763,6 +3763,7 @@ const td = () => /* @__PURE__ */ h("svg", { viewBox: "0 0 1024 1024", version: "
3763
3763
  exitSession: "Exit temporary session",
3764
3764
  collapseSidebar: "Collapse the sidebar",
3765
3765
  newConversation: "New conversation",
3766
+ historySession: "History session ({count})",
3766
3767
  newCreateConversation: "Create new conversation",
3767
3768
  searchTopics: "Search topics",
3768
3769
  noTopic: "No topic at the moment",
@@ -3888,6 +3889,7 @@ const td = () => /* @__PURE__ */ h("svg", { viewBox: "0 0 1024 1024", version: "
3888
3889
  exitSession: "退出临时会话",
3889
3890
  collapseSidebar: "收起侧边栏",
3890
3891
  newConversation: "新会话",
3892
+ historySession: "历史会话({count})",
3891
3893
  newCreateConversation: "新建对话",
3892
3894
  searchTopics: "搜索话题",
3893
3895
  noTopic: "暂无话题",
@@ -22665,32 +22667,45 @@ class Ly {
22665
22667
  "aitopics",
22666
22668
  e.type
22667
22669
  ).load();
22668
- this.configList = Array.isArray(i) ? i : [], this.configList && this.configList.length > 0 && (this.resourceMode === "REMOTE" && this.resourceOptions ? (this.remoteSessionList = await this.resourceOptions.getSessionList(), await this.asyncRemoteSession()) : this.configList.forEach((r, s) => {
22669
- Object.prototype.hasOwnProperty.call(r, "sequence") || (r.sequence = s), Object.prototype.hasOwnProperty.call(r, "isTop") || (r.isTop = 0), this.topics.value = [...this.topics.value, new It(r)];
22670
- }));
22670
+ if (this.configList = Array.isArray(i) ? i : [], this.configList && this.configList.length > 0)
22671
+ if (this.resourceMode === "REMOTE" && this.resourceOptions)
22672
+ this.remoteSessionList = await this.resourceOptions.getSessionList(), await this.asyncRemoteSession();
22673
+ else {
22674
+ let r = 1;
22675
+ this.configList.forEach((s, o) => {
22676
+ s.captionComputed || (s.caption = C.t.value("historySession", {
22677
+ count: r
22678
+ }), r += 1), Object.prototype.hasOwnProperty.call(s, "sequence") || (s.sequence = o), Object.prototype.hasOwnProperty.call(s, "isTop") || (s.isTop = 0), this.topics.value = [...this.topics.value, new It(s)];
22679
+ });
22680
+ }
22671
22681
  }
22672
22682
  }
22673
22683
  /**
22674
22684
  * 同步远程会话(以远程会话为准)
22675
22685
  */
22676
22686
  async asyncRemoteSession() {
22677
- !this.remoteSessionList || this.remoteSessionList.length === 0 || this.storageMode === "DEFAULT" && this.configList.length === 0 || this.remoteSessionList.forEach((e) => {
22678
- let t;
22679
- if (this.storageMode === "DEFAULT" && (t = this.configList.find((i) => {
22680
- var r;
22681
- return ((r = i.aiChat) == null ? void 0 : r.sessionid) === e.session_id;
22682
- })), this.storageMode === "REMOTESESSION" && e.ui_meta && (t = Vu(e.ui_meta)), t && t.id) {
22683
- t.realid = e.realid, t.sequence = e.sequence, t.isTop = e.is_top ? e.is_top : 0, e.caption && (t.caption = e.caption);
22684
- const i = this.topics.value.findIndex(
22685
- (r) => {
22686
- var s;
22687
- return ((s = r.aiChat) == null ? void 0 : s.sessionid) === e.session_id;
22687
+ if (!this.remoteSessionList || this.remoteSessionList.length === 0 || this.storageMode === "DEFAULT" && this.configList.length === 0)
22688
+ return;
22689
+ let e = 1;
22690
+ this.remoteSessionList.forEach((t) => {
22691
+ let i;
22692
+ if (this.storageMode === "DEFAULT" && (i = this.configList.find((r) => {
22693
+ var s;
22694
+ return ((s = r.aiChat) == null ? void 0 : s.sessionid) === t.session_id;
22695
+ })), this.storageMode === "REMOTESESSION" && t.ui_meta && (i = Vu(t.ui_meta)), i && !i.captionComputed && (i.caption = C.t.value("historySession", {
22696
+ count: e
22697
+ }), e += 1), i && i.id) {
22698
+ i.realid = t.realid, i.sequence = t.sequence, i.isTop = t.is_top ? t.is_top : 0, t.caption && (i.caption = t.caption);
22699
+ const r = this.topics.value.findIndex(
22700
+ (s) => {
22701
+ var o;
22702
+ return ((o = s.aiChat) == null ? void 0 : o.sessionid) === t.session_id;
22688
22703
  }
22689
22704
  );
22690
- i === -1 ? this.topics.value = [
22705
+ r === -1 ? this.topics.value = [
22691
22706
  ...this.topics.value,
22692
- new It(t)
22693
- ] : (this.topics.value.splice(i, 1, new It(t)), this.topics.value = [...this.topics.value]);
22707
+ new It(i)
22708
+ ] : (this.topics.value.splice(r, 1, new It(i)), this.topics.value = [...this.topics.value]);
22694
22709
  }
22695
22710
  });
22696
22711
  }